Make DnD code use GtkStyleContext for the highlight rectangle.
authorCarlos Garnacho <carlosg@gnome.org>
Tue, 4 Jan 2011 01:32:04 +0000 (02:32 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 4 Jan 2011 02:06:20 +0000 (03:06 +0100)
gtk/gtkdnd-quartz.c
gtk/gtkdnd.c
gtk/gtkstylecontext.h

index d990029cd86cc27fc7e7a30b2b02e839536039c0..f541cf1689378e068992dd970ab5eed034f1b8a9 100644 (file)
@@ -347,11 +347,14 @@ gtk_drag_highlight_draw (GtkWidget *widget,
 {
   int width = gtk_widget_get_allocated_width (widget);
   int height = gtk_widget_get_allocated_height (widget);
+  GtkStyleContext *context;
 
-  gtk_paint_shadow (gtk_widget_get_style (widget), cr,
-                    GTK_STATE_NORMAL, GTK_SHADOW_OUT,
-                    widget, "dnd",
-                    0, 0, width, height);
+  gtk_style_context_save (context);
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_DND);
+
+  gtk_render_frame (context, cr, 0, 0, width, height);
+
+  gtk_style_context_restore (context);
 
   cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */
   cairo_set_line_width (cr, 1.0);
index bb90456026911bcd7d0009c627770715609b177c..933172ba9c8a9016984169918fd9af63c84494bd 100644 (file)
@@ -1104,11 +1104,16 @@ gtk_drag_highlight_draw (GtkWidget *widget,
 {
   int width = gtk_widget_get_allocated_width (widget);
   int height = gtk_widget_get_allocated_height (widget);
+  GtkStyleContext *context;
 
-  gtk_paint_shadow (gtk_widget_get_style (widget), cr,
-                    GTK_STATE_NORMAL, GTK_SHADOW_OUT,
-                    widget, "dnd",
-                    0, 0, width, height);
+  context = gtk_widget_get_style_context (widget);
+
+  gtk_style_context_save (context);
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_DND);
+
+  gtk_render_frame (context, cr, 0, 0, width, height);
+
+  gtk_style_context_restore (context);
 
   cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */
   cairo_set_line_width (cr, 1.0);
index 97f7e768302e26526cd576eddfb013246c04b9ae..ab9be702e8d4e43bb1c241fb9808aca4e0d138bb 100644 (file)
@@ -353,6 +353,13 @@ struct _GtkStyleContextClass
  */
 #define GTK_STYLE_CLASS_FRAME "frame"
 
+/**
+ * GTK_STYLE_CLASS_DND:
+ *
+ * A CSS class for a drag-and-drop indicator
+ */
+#define GTK_STYLE_CLASS_DND "dnd"
+
 /**
  * GTK_STYLE_CLASS_INFO:
  *